package it.uniba.di.mas.jpnde.impl;

import jade.core.behaviours.Behaviour;
import jade.util.Logger;
import it.uniba.di.mas.jpnde.core.ITransitionTask;
import it.uniba.di.mas.jpnde.core.PNContext;
import it.uniba.di.mas.jpnde.core.Token;
import it.uniba.di.mas.jpnde.core.Transition;

public abstract class AbstractTransitionTask implements ITransitionTask{
	protected Behaviour behaviour=null;
	protected Transition transition=null;
	protected Logger logger=null;
	
	@Override
	public void init(Behaviour behaviour, Transition transition) {
		// TODO Auto-generated method stub
		this.behaviour=behaviour;
		this.transition=transition;
		//System.out.println("TransitionTask.init :"+transition.getId());
		logger=Logger.getMyLogger(this.getClass().getName());
		logger.log(Logger.INFO,"init "+transition.getId()); 
	}
	
	@Override
	public void end() {
		// TODO Auto-generated method stub
		//System.out.println("TransitionTask.end :"+transition.getId());
		logger.log(Logger.INFO,"end "+transition.getId()); 
	}

	@Override
	public abstract Token exec(PNContext context) throws Throwable;
}
